package com.slmxz.tms.core.exception;

import com.slmxz.tms.common.enums.BizMessageEnum;
import lombok.Getter;

/**
 * 自定义业务异常
 * @author sunyao
 * @Date 2024-12-01
 */
@Getter
public class BizException extends RuntimeException {

    private String errorCode;

    private Object[] messageFormatParams;

    public BizException(BizMessageEnum bizMessageEnum) {
        this.errorCode = bizMessageEnum.getCode();
    }

    public BizException(String msg) {
        super(msg);
    }

    public BizException(String errorCode,String msg) {
        super(msg);
        this.errorCode = errorCode;
    }

    public BizException(BizMessageEnum bizMessageEnum, Object[] messageFormatParams) {
        this.errorCode = bizMessageEnum.getCode();
        this.messageFormatParams = messageFormatParams;
    }


    public String getErrorCode() {
        return errorCode;
    }

    public Object[] getMessageFormatParams() {
        return messageFormatParams;
    }
}
